import { createRouter, createWebHistory } from 'vue-router'
import LoginView from '../views/LoginView.vue'
import OnlineView from '../views/smon/OnlineView.vue'

const router = createRouter({
  history: createWebHistory(import.meta.env.BASE_URL),
  routes: [
    {
      path: '/',
      name: 'login',
      component: LoginView,
    },
    {
      path: '/index',
      name: 'index',
      redirect: '/index/welcome',
      component: ()=>import('../views/IndexView.vue'),
      children: [
        {
          path: '/index/welcome',
          name: 'welcome',
          component: ()=>import('../views/in/IndexContentView.vue'),
        },
        {
          path: '/index/profile',
          name: 'profile',
          component: ()=>import('../views/in/UserProfileView.vue'),
        }
      ]
    },
    {
      path: '/system',
      name: 'system',
      redirect: '/system/user',
      component: ()=>import('../views/SystemView.vue'),
      children: [
        {//用户
          path: '/system/user',
          name: 'user',
          component: ()=>import('../views/sm/UserView.vue')
        },
        {//角色
          path: '/system/role',
          name: 'role',
          component: ()=>import('../views/sm/RoleView.vue')
        },
        {//菜单
          path: '/system/menu',
          name: 'menu',
          component: ()=>import('../views/sm/MenuView.vue')
        },
        {//部门
          path: '/system/dept',
          name: 'dept',
          component: ()=>import('../views/sm/DeptView.vue')
        },
        {//岗位
          path: '/system/post',
          name: 'post',
          component: ()=>import('../views/sm/PostView.vue')
        },
        {//字典
          path: '/system/dect',
          name: 'dect',
          component: ()=>import('../views/sm/DectView.vue')
        },
        {//参数
          path: '/system/config',
          name: 'config',
          component: ()=>import('../views/sm/ConfigView.vue')
        },
        {//通知
          path: '/system/notice',
          name: 'notice',
          component: ()=>import('../views/sm/NoticeView.vue')
        },
        {//操作日志
          path: '/system/operlog',
          name: 'operlog',
          component: ()=>import('../views/sm/OperlogView.vue')
        },
        {//登录日志
          path: '/system/loginfor',
          name: 'loginfor',
          component: ()=>import('../views/sm/LoginforView.vue')
        }
      ]
    },
    {
      path: '/monitor',
      name: 'monitor',
      redirect: '/monitor/online',
      component: ()=>import('../views/MonitorView.vue'),
      children: [
        {//在线用户
          path: '/monitor/online',
          name: 'online',
          component: OnlineView
        },
        {//定时任务
          path: '/monitor/job',
          name: 'job',
          component: ()=>import('../views/smon/JobView.vue')
        },
        {//数据监控
          path: '/monitor/druid',
          name: 'druid',
          component: ()=>import('../views/smon/DruidView.vue')
        },
        {//服务监控
          path: '/monitor/server',
          name: 'server',
          component: ()=>import('../views/smon/ServerView.vue')
        },
        {//缓存
          path: '/monitor/cache',
          name: 'cache',
          component: ()=>import('../views/smon/CacheView.vue')
        },
        {//缓存列表
          path: '/monitor/cacheList',
          name: 'cacheList',
          component: ()=>import('../views/smon/CacheListView.vue')
        }
      ]
    },
    {
      path: '/tool',
      name: 'tool',
      redirect: '/tool/build',
      component: ()=>import('../views/ToolView.vue'),
      children: [
        {//参数
          path: '/tool/build',
          name: 'build',
          component: ()=>import('../views/st/BuildView.vue')
        },
        {//代码生成
          path: '/tool/gen',
          name: 'gen',
          component: ()=>import('../views/st/GenView.vue')
        },
        {//系统接口
          path: '/tool/swagger',
          name: 'swagger',
          component: ()=>import('../views/st/SwaggerView.vue')
        }
      ]
    },
    {
      path: '/home',
      name: 'home',
      component: ()=>import('../views/HomeView.vue')
    },
    {
      path: '/about',
      name: 'about',
      component: ()=>import('../views/AboutView.vue')
      // route level code-splitting
      // this generates a separate chunk (About.[hash].js) for this route
      // which is lazy-loaded when the route is visited.
    },
    {
      path: '/help',
      name: 'help',
      component: ()=>import('../views/HelpView.vue')
    }
  ],
})

export default router
